//###############
// FILE : OROperator.java
// WRITER : Lior Zimmerman liorz06 066462300
// WRITER : Ohad Dan ohad_dan 036767960
// EXERCISE : oop ex3 2008
// DESCRIPTION: Representation of the binary logic operator OR.
//###############
package oop.ex3.fileSearchModel.filters;
import oop.ex3.fileSearchModel.filters.exceptions.*;
/**
 * Representation of the binary logic operator OR.
 */
public class OROperator extends LogicOperator {
	/**
	 * Constructs a new OR logic operator.
	 */
    public OROperator() {
    	super();
    }
    /**
     * Constructs a new OR logic operator.
     * @param right Right child.
     * @param left Left child.
     * @param status Status of condition.
     */
    public OROperator( Conditionable right, Conditionable left,
    		STATUS status) {
    	super( right, left, status);
    }
 /**
  * Return the value of the condition.
  * @return Condition's status - True,False,Unknown.
  */
    public STATUS getCondition() throws FilterDataException{
        if ( _leftTerm.getCondition() == STATUS.TRUE ||
                _rightTerm.getCondition() == STATUS.TRUE) {
            return STATUS.TRUE;
        }else if ( _leftTerm.getCondition() == STATUS.FALSE && 
                _rightTerm.getCondition() == STATUS.FALSE ) {
            return STATUS.FALSE;
        }
        return STATUS.UNKNOWN;
    }
    /**
	 *  Clones the object - return a new object with same properties.
	 */
    public LogicOperator clone() {
    	return new OROperator( _leftTerm, _rightTerm, _status);
    }

}
